home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / util / wb / BWS_Scalos.lha / BWS_Scalos / Scalos_Rename / other.e < prev    next >
Text File  |  2001-12-05  |  2KB  |  88 lines

  1. OPT MODULE
  2. OPT EXPORT
  3. OPT PREPROCESS
  4.  
  5. MODULE '*loc','*locnums','dos/dos','dos/dosextens','muimaster','libraries/mui'
  6.  
  7. ENUM ERR_NONE, ERR_ASL, ERR_KICK
  8. RAISE ERR_ASL  IF Mui_AllocAslRequest()=NIL,ERR_KICK IF KickVersion()=FALSE
  9.  
  10. OBJECT lvo; typ,nam,pth,ful;ENDOBJECT
  11.  
  12. ENUM ID_HELP=2,ID_ABOUT,ID_ABOUTMUI
  13.  
  14. PROC cmp1Func(s1:PTR TO lvo,s2:PTR TO lvo) IS OstrCmp(s2.ful,s1.ful)
  15.  
  16. PROC icon(n); DEF s;s:=String(StrLen(n)+5); StringF(s,'\s.info',n); ENDPROC s
  17.  
  18. PROC news(s); DEF ns; ns:=String(StrLen(s)); StrCopy(ns,s); ENDPROC ns
  19.  
  20. PROC nStrCmp(o,n,l=-1); DEF ou[256]:STRING,nu[256]:STRING;
  21. StrCopy(ou,o); UpperStr(ou)
  22. StrCopy(nu,n); UpperStr(nu)
  23. ENDPROC StrCmp(ou,nu,l)
  24.  
  25. PROC writebd(b,l:PTR TO LONG,n); DEF a,c,o
  26. IF c:=Open(b,NEWFILE)
  27. o:=SetStdOut(c)
  28. FOR a:=0 TO n-1 DO WriteF('\s\n',l[a])
  29. SetStdOut(o)
  30. Close(c)
  31. ENDIF
  32. ENDPROC
  33.  
  34. PROC devname(path); DEF dn,p
  35. p:=InStr(path,':')
  36. dn:=String(p+1)
  37. StrCopy(dn,path,p+1)
  38. ENDPROC dn
  39.  
  40. PROC volExists(vol,type="V") HANDLE;
  41. DEF dlock=0,dl:doslist,v,s[256]:STRING,pars,t1;
  42. v:=news(vol); UpperStr(v);
  43. IF v[StrLen(v)-1]=":" THEN v[StrLen(v)-1]:=0
  44. SELECT type
  45. CASE "V"; t1:=LDF_VOLUMES
  46. CASE "A"; t1:=LDF_ASSIGNS
  47. CASE "D"; t1:=LDF_DEVICES
  48. ENDSELECT
  49. pars:=t1 OR LDF_READ;
  50. dl:=(dlock:=LockDosList(pars));
  51.  WHILE dl:=NextDosEntry(dl,pars);
  52.  StrCopy(s,BADDR(dl.name)+1);
  53.  UpperStr(s)
  54.  IF StrCmp(s,v) THEN Raise(-1)
  55.  ENDWHILE;
  56. EXCEPT DO
  57. IF dlock THEN UnLockDosList(pars)
  58. ENDPROC exception
  59.  
  60. PROC bump(name:PTR TO CHAR, deft,app,win,lo); DEF c,bump,str[256]:STRING
  61. bump:=String(StrLen(name)+10)
  62. c:=1
  63. StringF(bump,'\s.\d',name,c++)
  64.   IF FileLength(bump)<>-1
  65.   WHILE FileLength(bump)<>-1 DO StringF(bump,'\s.\d',name,c++)
  66.   ENDIF
  67. StringF(str,'\s !\n\s\n\n\s',locs(lo,MSG_FileExists),name,locs(lo,MSG_FileExOpts))
  68. c:=muireq(deft,str,locs(lo,GAD_FileExOpts),app,win)
  69.   IF c=1; StringF(str,'c:Delete <>nil: "\s" all',name); Execute(str,0,0)
  70.   ELSEIF c=2; StringF(name,'\s',bump)
  71.   ELSEIF c=3; RETURN -6
  72.   ELSE; RETURN -1
  73.   ENDIF
  74. ENDPROC 0
  75.  
  76. PROC muireq(title=0,body=0,gads=0,app=0,win=0,args=0)
  77. DEF answer
  78. answer:=Mui_RequestA(app,win,0,title,gads,body,args)
  79. ENDPROC answer
  80.  
  81. PROC makemc(mp:PTR TO mui_command,m:PTR TO mui_command)
  82. mp.mc_name:=m.mc_name
  83. mp.mc_template:=m.mc_template
  84. mp.mc_parameters:=m.mc_parameters
  85. mp.mc_hook:=m.mc_hook
  86. ENDPROC
  87.  
  88.